package com.jyw.business.comp.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.jyw.business.comp.domain.dto.HolidaySetDto;
import com.jyw.common.core.domain.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jyw.common.annotation.Log;
import com.jyw.common.core.controller.BaseController;
import com.jyw.common.core.domain.AjaxResult;
import com.jyw.common.enums.BusinessType;
import com.jyw.business.comp.domain.CompScheduleHoliday;
import com.jyw.business.comp.service.ICompScheduleHolidayService;
import com.jyw.common.utils.poi.ExcelUtil;
import com.jyw.common.core.page.TableDataInfo;

/**
 * 综合-日历配置Controller
 * 
 * @author ruoyi
 * @date 2023-12-25
 */
@RestController
@RequestMapping("/comp/holiday")
@Api(tags = "日历配置")
public class CompScheduleHolidayController extends BaseController
{
    @Autowired
    private ICompScheduleHolidayService compScheduleHolidayService;

    /**
     * 查询综合-日历配置列表
     */
    @PreAuthorize("@ss.hasPermi('comp:holiday:list')")
    @GetMapping("/list")
    @ApiOperation("日历查询")
    @ApiImplicitParam(value = "year",name = "年份")
    public CommonResult<List<CompScheduleHoliday>> list(String year)
    {
        return CommonResult.success(compScheduleHolidayService.yearList(year));
    }


    /**
     * 节假日设置/取消
     */
    @PreAuthorize("@ss.hasPermi('comp:holiday:set')")
    @PutMapping("/set")
    @ApiOperation("节假日设置")
    public CommonResult set(@RequestBody HolidaySetDto dto)
    {
        compScheduleHolidayService.setHoliday(dto);
        return CommonResult.success();
    }

    /**
     * 删除综合-日历配置
     */
    @PreAuthorize("@ss.hasPermi('comp:holiday:remove')")
    @Log(title = "综合-日历配置", businessType = BusinessType.DELETE)
	@DeleteMapping()
    @ApiOperation("清空")
    @ApiImplicitParam(value = "year",name = "年份")
    public CommonResult remove(String year)
    {
        compScheduleHolidayService.clean(year);
        return CommonResult.success();
    }
}
